﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="三分厂内月报表.aspx.cs" Inherits="syc.Fc.三分厂内月报表" %>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">
<%
    DateTime d1,d2,d3;
    int fc=3;
    this.Data = new double[450];
    
    if (this.ChanPin.Text == "1" || this.ChanPin.Text == "2")
    {
        this.GangJi.Text = "J55";
    }
    else
    {
        this.GangJi.Text = "N80Q";
    }
    if (this.ChanPin.Text == "1" || this.ChanPin.Text == "3")
    {
        this.GuiGe.Text = "Φ88.9×12.5";
    }
    else
    {
        this.GuiGe.Text = "Φ153.67×13.5";
    }

    if (!this.IsPostBack)
    {
        this.NianDu.Text = DateTime.Today.Year.ToString();
        this.YueFen.Text = DateTime.Today.Month.ToString();
    }

    System.Data.SqlClient.SqlConnection Conn = new System.Data.SqlClient.SqlConnection();
    Conn.ConnectionString = ConfigurationManager.ConnectionStrings["SCMConnectionString1"].ConnectionString;
    Conn.Open();
    System.Data.SqlClient.SqlCommand Cmd = new System.Data.SqlClient.SqlCommand();
    Cmd.Connection = Conn;

    Cmd.CommandText = @"declare @d1 smalldatetime
declare @d2 smalldatetime
if exists(select * from 生产月设置 where 分厂=@fc and 年度=@y and 月份=@m)
begin
	select @d1=起始日期,@d2=截止日期 from 生产月设置 where 分厂=@fc and 年度=@y and 月份=@m
	if exists(select * from 生产月设置 where 分厂=@fc and 年度=@y and 月份=1)
	begin
		select @d1 as 月初,@d2 as 月末,起始日期 as 年初 from 生产月设置 where 分厂=@fc and 年度=@y and 月份=1
	end
end";
    Cmd.CommandText = Cmd.CommandText.Replace("@y", this.NianDu.Text);
    Cmd.CommandText = Cmd.CommandText.Replace("@m", this.YueFen.Text);
    Cmd.CommandText = Cmd.CommandText.Replace("@fc", fc.ToString());
    System.Data.SqlClient.SqlDataReader Reader = Cmd.ExecuteReader();
    if (Reader.Read())
    {
        d1 = (DateTime)Reader["月初"];
        d2 = (DateTime)Reader["月末"];
        d3 = (DateTime)Reader["年初"];
        this.Date1.Text = d1.ToLongDateString();
        this.Date2.Text = d2.ToLongDateString();
        this.Date3.Text = d3.ToLongDateString();
    }
    else
    {
        this.Date1.Text = this.NianDu.Text + "年" + this.YueFen.Text + "月" + "1日";
        d1 = DateTime.Parse(this.Date1.Text);
        d2 = d1.AddMonths(1).AddDays(-1);
        this.Date2.Text = d2.ToLongDateString();
        this.Date3.Text = this.NianDu.Text + "年1月1日";
        d3 = DateTime.Parse(this.Date3.Text);
    }
    Reader.Close();
    
    Cmd.CommandText = "接箍生产月报数据";
    Cmd.CommandType = System.Data.CommandType.StoredProcedure;

    Cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@分厂ID", System.Data.SqlDbType.Int, 4,
        System.Data.ParameterDirection.Input, true, 0, 0, "", System.Data.DataRowVersion.Proposed, fc));
    Cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@产品类别ID", System.Data.SqlDbType.Int, 4, 
        System.Data.ParameterDirection.Input, true, 0, 0, "", System.Data.DataRowVersion.Proposed, int.Parse(this.ChanPin.Text)));
    Cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@d1", System.Data.SqlDbType.Date, 3, 
        System.Data.ParameterDirection.Input, true, 0, 0, "", System.Data.DataRowVersion.Proposed, d1));
    Cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@d2", System.Data.SqlDbType.Date, 3, 
        System.Data.ParameterDirection.Input, true, 0, 0, "", System.Data.DataRowVersion.Proposed, d2));
    Cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@d3", System.Data.SqlDbType.Date, 3, 
        System.Data.ParameterDirection.Input, true, 0, 0, "", System.Data.DataRowVersion.Proposed, d3));

    Reader = Cmd.ExecuteReader();
    int x = 0;
    int gongduan;
    while (Reader.Read())
    {
        if (Reader.IsDBNull(2)) continue;
        x = ((int)Reader["类别"] - 1) * 200;

        gongduan = (int)Reader["工段"];
        x += (gongduan - 1) * 50;

        Data[x + 0] = (int)Reader["原料投入根数"];
        Data[x + 1] = Convert.ToDouble((decimal)Reader["原料投入重量"]);
        Data[x + 2] = (int)Reader["切料支数"];
        Data[x + 3] = (int)Reader["粗车合格"];
        Data[x + 4] = (int)Reader["粗车不合格"];
        Data[x + 5] = (int)Reader["打字"];
        Data[x + 6] = (int)Reader["磁粉碳伤合格"];
        Data[x + 7] = (int)Reader["磁粉碳伤不合格"];
        Data[x + 8] = (int)Reader["磷化支数"];
        Data[x + 9] = Convert.ToDouble((decimal)Reader["边角料量"]);

        Data[x + 10] = (int)Reader["车丝1"];
        Data[x + 11] = (int)Reader["车丝2"];
        Data[x + 12] = (int)Reader["车丝3"];
        Data[x + 13] = (int)Reader["车丝4"];
        Data[x + 14] = (int)Reader["车丝5"];
        Data[x + 15] = (int)Reader["车丝6"];
        Data[x + 16] = (int)Reader["车丝7"];
        Data[x + 17] = (int)Reader["车丝8"];
        Data[x + 18] = (int)Reader["车丝9"];
        Data[x + 19] = (int)Reader["车丝10"];

        Data[x + 20] = (int)Reader["车丝11"];
        Data[x + 21] = (int)Reader["车丝12"];
        Data[x + 22] = (int)Reader["车丝13"];
        Data[x + 23] = (int)Reader["车丝14"];
        Data[x + 24] = (int)Reader["车丝15"];
        Data[x + 25] = (int)Reader["车丝16"];
        Data[x + 26] = (int)Reader["车丝17"];
        Data[x + 27] = (int)Reader["车丝18"];
        Data[x + 28] = (int)Reader["车丝19"];
        Data[x + 29] = (int)Reader["车丝20"];

        Data[x + 30] = (int)Reader["车废1"];
        Data[x + 31] = (int)Reader["车废2"];
        Data[x + 32] = (int)Reader["车废3"];
        Data[x + 33] = (int)Reader["车废4"];
        Data[x + 34] = (int)Reader["车废5"];
        Data[x + 35] = (int)Reader["车废6"];
        Data[x + 36] = (int)Reader["车废7"];
        Data[x + 37] = (int)Reader["车废8"];
        Data[x + 38] = (int)Reader["车废9"];
        Data[x + 39] = (int)Reader["车废10"];

        Data[x + 40] = (int)Reader["车废11"];
        Data[x + 41] = (int)Reader["车废12"];
        Data[x + 42] = (int)Reader["车废13"];
        Data[x + 43] = (int)Reader["车废14"];
        Data[x + 44] = (int)Reader["车废15"];
        Data[x + 45] = (int)Reader["车废16"];
        Data[x + 46] = (int)Reader["车废17"];
        Data[x + 47] = (int)Reader["车废18"];
        Data[x + 48] = (int)Reader["车废19"];
        Data[x + 49] = (int)Reader["车废20"];

    }
    Reader.Close();
    Reader.Dispose();
    Cmd.Dispose();
    Conn.Close();
    Conn.Dispose();

%>

<div id="wintop" class="wintop"><%=this.ChanPin.SelectedItem.Text%>月生产报表</div>
<asp:Panel ID="Panel1" runat="server" CssClass="panel">
接箍类别：<asp:DropDownList ID="ChanPin" runat="server" Width="120px" AutoPostBack="true">
    <asp:ListItem Value="1">油管接箍(J55)</asp:ListItem>
    <asp:ListItem Value="2">套管接箍(J55)</asp:ListItem>
    <asp:ListItem Value="3">油管接箍(N80Q)</asp:ListItem>
    <asp:ListItem Value="4">套管接箍(N80Q)</asp:ListItem>
</asp:DropDownList>
<span style="margin-left:10px;"></span>年度：<asp:DropDownList ID="NianDu" runat="server" Width="60px" AutoPostBack="true">
    <asp:ListItem>2010</asp:ListItem>
    <asp:ListItem>2011</asp:ListItem>
    <asp:ListItem>2012</asp:ListItem>
    <asp:ListItem>2013</asp:ListItem>
    <asp:ListItem>2014</asp:ListItem>
    <asp:ListItem>2015</asp:ListItem>
</asp:DropDownList>

月份：<asp:DropDownList ID="YueFen" runat="server" Width="60px" AutoPostBack="true">
    <asp:ListItem>1</asp:ListItem>
    <asp:ListItem>2</asp:ListItem>
    <asp:ListItem>3</asp:ListItem>
    <asp:ListItem>4</asp:ListItem>
    <asp:ListItem>5</asp:ListItem>
    <asp:ListItem>6</asp:ListItem>
    <asp:ListItem>7</asp:ListItem>
    <asp:ListItem>8</asp:ListItem>
    <asp:ListItem>9</asp:ListItem>
    <asp:ListItem>10</asp:ListItem>
    <asp:ListItem>11</asp:ListItem>
    <asp:ListItem>12</asp:ListItem>
</asp:DropDownList> 
<span style="margin-left:10px;"></span>年初：<asp:Label ID="Date3" runat="server" Text=""></asp:Label><span style="margin-left:10px;"></span>月初：<asp:Label ID="Date1" runat="server" Text=""></asp:Label><span style="margin-left:10px;"></span>月末：<asp:Label ID="Date2" runat="server"></asp:Label>
<span style="margin-left:10px;"></span><input type="button" value="导出Excel" class="button" onclick="Export();"/>
</asp:Panel>
<asp:Label ID="GangJi" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="GuiGe" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="BianHao" runat="server" Text="" Visible="false"></asp:Label>


<asp:Panel ID="Panel2" runat="server" CssClass="panel3">
<style type="text/css">
td.bb{border:0.5pt solid black;text-align:center;padding:0.5pt;font-size:11pt;height:21px;font-family:宋体;}
td.nb{border:none;text-align:center;padding:0.5pt;font-size:11pt;height:21px;font-family:宋体;}
</style>
<table id=mt border=0 cellpadding=0 style=border-collapse:collapse;>
<tr>
<td colspan=12 class=nb style=font-size:18pt;font-weight:bold;height:28pt;><%=this.ChanPin.SelectedItem.Text.Substring(0,4) %>月生产报表</td>
</tr>
<tr>
<td class=nb colspan=2><%=this.Date1.Text %></td>
<td class=nb colspan=3>品种：<%=this.ChanPin.SelectedItem.Text.Substring(0,4) %></td>
<td class=nb colspan=2>钢级：<%=this.GangJi.Text%></td>
<td class=nb colspan=3>规格(mm)：<%=this.GuiGe.Text%></td>
<td class=nb colspan=2>编号：SYC/ZJ-JG3-13</td>
</tr>
<tr>
<td class=bb colspan=2 rowspan=2 style='text-align:left;mso-diagonal-down:.5pt solid windowtext;'>　　　　　　产量<br>　类别</td>
<td class=bb colspan=2>甲班组</td>
<td class=bb colspan=2>乙班组</td>
<td class=bb colspan=2>丙班组</td>
<td class=bb colspan=2>丁班组</td>
<td class=bb colspan=2>合计</td>
</tr>
<tr>
<td class=bb>当月</td>
<td class=bb>年累计</td>
<td class=bb>当月</td>
<td class=bb>年累计</td>
<td class=bb>当月</td>
<td class=bb>年累计</td>
<td class=bb>当月</td>
<td class=bb>年累计</td>
<td class=bb>当月</td>
<td class=bb>年累计</td>
</tr>
<tr>
<td class=bb rowspan=2 width=50>原料<br>投入</td>
<td class=bb width=90>根数</td>
<td class=bb width=75><%=Data[0] %></td>
<td class=bb width=85><%=Data[200] %></td>
<td class=bb width=75><%=Data[50] %></td>
<td class=bb width=85><%=Data[250] %></td>
<td class=bb width=75><%=Data[100] %></td>
<td class=bb width=85><%=Data[300] %></td>
<td class=bb width=75><%=Data[150] %></td>
<td class=bb width=85><%=Data[350] %></td>
<td class=bb width=100><%=Data[0] + Data[50] + Data[100] + Data[150]%></td>
<td class=bb width=140><%=Data[200] + Data[250] + Data[300] + Data[350]%></td>
</tr>
<tr>
<td class=bb>重量(kg)</td>
<td class=bb><%=Data[1] %></td>
<td class=bb><%=Data[201] %></td>
<td class=bb><%=Data[51] %></td>
<td class=bb><%=Data[251] %></td>
<td class=bb><%=Data[101] %></td>
<td class=bb><%=Data[301] %></td>
<td class=bb><%=Data[151] %></td>
<td class=bb><%=Data[351] %></td>
<td class=bb><%=Data[1] + Data[51] + Data[101] + Data[151]%></td>
<td class=bb><%=Data[201] + Data[251] + Data[301] + Data[351]%></td>
</tr>
<tr>
<td class=bb rowspan=2>切料</td>
<td class=bb>支数</td>
<td class=bb><%=Data[2] %></td>
<td class=bb><%=Data[202] %></td>
<td class=bb><%=Data[52] %></td>
<td class=bb><%=Data[252] %></td>
<td class=bb><%=Data[102] %></td>
<td class=bb><%=Data[302] %></td>
<td class=bb><%=Data[152] %></td>
<td class=bb><%=Data[352] %></td>
<td class=bb><%=Data[2] + Data[52] + Data[102] + Data[152]%></td>
<td class=bb><%=Data[202] + Data[252] + Data[302] + Data[352]%></td>
</tr>
<tr>
<td class=bb>重量(kg)</td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<td class=bb rowspan=2>粗车</td>
<td class=bb>合格</td>
<td class=bb><%=Data[3] %></td>
<td class=bb><%=Data[203] %></td>
<td class=bb><%=Data[53] %></td>
<td class=bb><%=Data[253] %></td>
<td class=bb><%=Data[103] %></td>
<td class=bb><%=Data[303] %></td>
<td class=bb><%=Data[153] %></td>
<td class=bb><%=Data[353] %></td>
<td class=bb><%=Data[3] + Data[53] + Data[103] + Data[153]%></td>
<td class=bb><%=Data[203] + Data[253] + Data[303] + Data[353]%></td>
</tr>
<tr>
<td class=bb>不合格</td>
<td class=bb><%=Data[4] %></td>
<td class=bb><%=Data[204] %></td>
<td class=bb><%=Data[54] %></td>
<td class=bb><%=Data[254] %></td>
<td class=bb><%=Data[104] %></td>
<td class=bb><%=Data[304] %></td>
<td class=bb><%=Data[154] %></td>
<td class=bb><%=Data[354] %></td>
<td class=bb><%=Data[4] + Data[54] + Data[104] + Data[154]%></td>
<td class=bb><%=Data[204] + Data[254] + Data[304] + Data[354]%></td>
</tr>
<td class=bb>打字</td>
<td class=bb>支数</td>
<td class=bb><%=Data[5] %></td>
<td class=bb><%=Data[205] %></td>
<td class=bb><%=Data[55] %></td>
<td class=bb><%=Data[255] %></td>
<td class=bb><%=Data[105] %></td>
<td class=bb><%=Data[305] %></td>
<td class=bb><%=Data[155] %></td>
<td class=bb><%=Data[355] %></td>
<td class=bb><%=Data[5] + Data[55] + Data[105] + Data[155]%></td>
<td class=bb><%=Data[205] + Data[255] + Data[305] + Data[355]%></td>
</tr>
<tr>
<td class=bb rowspan=9>车丝<br>(支)</td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<tr>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<tr>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<tr>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<tr>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<tr>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<tr>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<tr>
<td class=bb>小计</td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
 
<tr>
<td class=bb rowspan=4>车丝<br>废品<br>(支)</td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<tr>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<tr>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<tr>
<td class=bb>小计</td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<tr>
<td class=bb rowspan=2>磁粉<br>碳伤</td>
<td class=bb>合格(支)</td>
<td class=bb><%=Data[6] %></td>
<td class=bb><%=Data[206] %></td>
<td class=bb><%=Data[56] %></td>
<td class=bb><%=Data[256] %></td>
<td class=bb><%=Data[106] %></td>
<td class=bb><%=Data[306] %></td>
<td class=bb><%=Data[156] %></td>
<td class=bb><%=Data[356] %></td>
<td class=bb><%=Data[6] + Data[56] + Data[106] + Data[156]%></td>
<td class=bb><%=Data[206] + Data[256] + Data[306] + Data[356]%></td>
</tr>
<tr>
<td class=bb>不合格(支)</td>
<td class=bb><%=Data[7] %></td>
<td class=bb><%=Data[207] %></td>
<td class=bb><%=Data[57] %></td>
<td class=bb><%=Data[257] %></td>
<td class=bb><%=Data[107] %></td>
<td class=bb><%=Data[307] %></td>
<td class=bb><%=Data[157] %></td>
<td class=bb><%=Data[357] %></td>
<td class=bb><%=Data[7] + Data[57] + Data[107] + Data[157]%></td>
<td class=bb><%=Data[207] + Data[257] + Data[307] + Data[357]%></td>
</tr>
<tr>
<td class=bb rowspan=2>磷化<br>处理</td>
<td class=bb>支数</td>
<td class=bb><%=Data[8] %></td>
<td class=bb><%=Data[208] %></td>
<td class=bb><%=Data[58] %></td>
<td class=bb><%=Data[258] %></td>
<td class=bb><%=Data[108] %></td>
<td class=bb><%=Data[308] %></td>
<td class=bb><%=Data[158] %></td>
<td class=bb><%=Data[358] %></td>
<td class=bb><%=Data[8] + Data[58] + Data[108] + Data[158]%></td>
<td class=bb><%=Data[208] + Data[258] + Data[308] + Data[358]%></td>
</tr>
<tr>
<td class=bb>重量(kg)</td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>
<tr>
<td class=bb colspan=2>边角料量(kg)</td>
<td class=bb><%=Data[9] %></td>
<td class=bb><%=Data[209] %></td>
<td class=bb><%=Data[59] %></td>
<td class=bb><%=Data[259] %></td>
<td class=bb><%=Data[109] %></td>
<td class=bb><%=Data[309] %></td>
<td class=bb><%=Data[159] %></td>
<td class=bb><%=Data[359] %></td>
<td class=bb><%=Data[9] + Data[59] + Data[109] + Data[159]%></td>
<td class=bb><%=Data[209] + Data[259] + Data[309] + Data[359]%></td>
</tr>
<tr>
<td class=bb colspan=2>车 削 量(kg)</td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
<td class=bb></td>
</tr>

<tr>
<td class=nb></td>
<td class=nb style=text-align:right;></td>
<td class=nb colspan=2></td>
<td class=nb></td>
<td class=nb></td>
<td class=nb></td>
<td class=nb></td>
<td class=nb></td>
<td class=nb></td>
<td class=nb style=text-align:right;>制表人：</td>
<td class=nb style=text-align:left;>
<%
    string op = (string)this.Session["OperatorName"];
    if (op == null)
    {
        op = "";
    }
    Response.Write("<span style=display:none>"+op+"</span>");
%>
</td>
</tr>
</table>
</asp:Panel>
</form>
<form id="form2" method="post" action="/PageExport.ashx">
<input type="hidden" name="filename" value="日生产报表.xls" />
<input type="hidden" name="content" value="" />
</form>
<script type="text/javascript">
    var notice = '<%=this.Notice %>';
    if (notice != '') {
        parent.showmsgbox(notice);
    }
    var chesi=new Array(<%
int i,j;
for(i=0;i<8;i++)
{
    for(j=10;j<50;j++)
    {
        Response.Write(this.Data[i*50+j]+",");
    }
}
%>0);
</script>
<script type="text/javascript">
    
    var textboxs = document.getElementsByTagName("input");
    var i,j;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            //textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "textbox") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }
    //导出Excel
    function Export() {
        var code = document.getElementById("Panel2").innerHTML;
        form2.content.value =
"<html xmlns:o='urn:schemas-microsoft-com:office:office'\nxmlns:x='urn:schemas-microsoft-com:office:excel'\nxmlns='http://www.w3.org/TR/REC-html40'>\n<head>\n<meta http-equiv=Content-Type content='text/html; charset=utf-8'>\n<style>\n<!--table\n@page\n{margin:.12in .12in .12in .12in;\n mso-header-margin:.2in;\n mso-footer-margin:.2in;\n mso-page-orientation:landscape;\n mso-horizontal-page-align:center;\n mso-vertical-page-align:center;}\nbr{mso-data-placement:same-cell;}\n-->\n</style>\n<!--[if gte mso 9]><xml>\n<x:ExcelWorkbook>\n<x:ExcelWorksheets>\n<x:ExcelWorksheet>\n<x:Name>日生产报表</x:Name>\n<x:WorksheetOptions>\n<x:DefaultRowHeight>285</x:DefaultRowHeight>\n<x:Print>\n<x:ValidPrinterInfo/>\n<x:Scale>100</x:Scale>\n<x:PaperSizeIndex>9</x:PaperSizeIndex>\n<x:HorizontalResolution>200</x:HorizontalResolution>\n<x:VerticalResolution>200</x:VerticalResolution>\n</x:Print>\n<x:Selected/>\n<x:Panes>\n<x:Pane>\n<x:Number>3</x:Number>\n<x:ActiveRow>0</x:ActiveRow>\n<x:ActiveCol>0</x:ActiveCol>\n</x:Pane>\n</x:Panes>\n</x:WorksheetOptions>\n</x:ExcelWorksheet>\n</x:ExcelWorkbook>\n</xml><![endif]-->\n</head>\n<body>"
        + code + "</body></html>";
        form2.submit();
    }
    //完成报表
    var chanpin = document.getElementById("ChanPin").value;
    var mt = document.getElementById("mt");
    function calc() {
        var cells;
        var rate1, rate2, rate3;
        var sum = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
        var sum2 = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
        var sum3 = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
        var t1, t2, k=0;
        if (chanpin == "2" || chanpin == "4") {
            rate1 = 10;
            rate2 = 6.1;
            rate3 = 3.9;
            for (i = 0; i < 7; i++) {
                cells = mt.rows[11 + i].cells;
                t1 = chesi[i] + chesi[40 + i] + chesi[80 + i] + chesi[120 + i];
                t2 = chesi[160 + i] + chesi[200 + i] + chesi[240 + i] + chesi[280 + i];
                cells[cells.length - 11].innerHTML = (i + 1) + "#";
                cells[cells.length - 10].innerHTML = chesi[i];
                cells[cells.length - 9].innerHTML = chesi[160 + i];
                cells[cells.length - 8].innerHTML = chesi[40 + i];
                cells[cells.length - 7].innerHTML = chesi[200 + i];
                cells[cells.length - 6].innerHTML = chesi[80 + i];
                cells[cells.length - 5].innerHTML = chesi[240 + i];
                cells[cells.length - 4].innerHTML = chesi[120 + i];
                cells[cells.length - 3].innerHTML = chesi[280 + i];

                cells[cells.length - 2].innerHTML = t1;
                cells[cells.length - 1].innerHTML = t2;


                sum[0] += chesi[i];
                sum[1] += chesi[160 + i];
                sum[2] += chesi[40 + i];
                sum[3] += chesi[200 + i];
                sum[4] += chesi[80 + i];
                sum[5] += chesi[240 + i];
                sum[6] += chesi[120 + i];
                sum[7] += chesi[280 + i];
                sum[8] += t1;
                sum[9] += t2;
                
                sum2[0] += chesi[i+20];
                sum2[1] += chesi[160 + i + 20];
                sum2[2] += chesi[40 + i + 20];
                sum2[3] += chesi[200 + i + 20];
                sum2[4] += chesi[80 + i + 20];
                sum2[5] += chesi[240 + i + 20];
                sum2[6] += chesi[120 + i + 20];
                sum2[7] += chesi[280 + i + 20];
                sum2[8] += chesi[i + 20] + chesi[40 + i + 20] + chesi[80 + i + 20] + chesi[120 + i + 20];
                sum2[9] += chesi[160 + i + 20] + chesi[200 + i + 20] + chesi[240 + i + 20] + chesi[280 + i + 20];

                sum3[0] += chesi[i + 20];
                sum3[1] += chesi[160 + i + 20];
                sum3[2] += chesi[40 + i + 20];
                sum3[3] += chesi[200 + i + 20];
                sum3[4] += chesi[80 + i + 20];
                sum3[5] += chesi[240 + i + 20];
                sum3[6] += chesi[120 + i + 20];
                sum3[7] += chesi[280 + i + 20];
                sum3[8] += chesi[i + 20] + chesi[40 + i + 20] + chesi[80 + i + 20] + chesi[120 + i + 20];
                sum3[9] += chesi[160 + i + 20] + chesi[200 + i + 20] + chesi[240 + i + 20] + chesi[280 + i + 20];

                if (i == 2 || i == 4 || i == 6) {
                    for (j = 0; j < 10; j++) {
                        mt.rows[20 + k].cells[j + (mt.rows[20 + k].cells.length == 11 ? 1 : 2)].innerHTML = sum3[j];
                    }
                    sum3 = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                    k++;
                }
            }

            for(i=0;i<10;i++) {
                mt.rows[19].cells[i+1].innerHTML = sum[i];
                mt.rows[23].cells[i + 1].innerHTML = sum2[i];
            }
            mt.rows[20].cells[1].innerHTML = "1-3#";
            mt.rows[21].cells[0].innerHTML = "4-5#";
            mt.rows[22].cells[0].innerHTML = "6-7#";
        }
        else {
            rate1 = 3.2;
            rate2 = 2.3;
            rate3 = 0.9;
            for (i = 7; i < 13; i++) {
                cells = mt.rows[11 + i -7].cells;
                t1 = chesi[i] + chesi[40 + i] + chesi[80 + i] + chesi[120 + i];
                t2 = chesi[160 + i] + chesi[200 + i] + chesi[240 + i] + chesi[280 + i];
                cells[cells.length - 11].innerHTML = (i + 1) + "#";
                cells[cells.length - 10].innerHTML = chesi[i];
                cells[cells.length - 9].innerHTML = chesi[160 + i];
                cells[cells.length - 8].innerHTML = chesi[40 + i];
                cells[cells.length - 7].innerHTML = chesi[200 + i];
                cells[cells.length - 6].innerHTML = chesi[80 + i];
                cells[cells.length - 5].innerHTML = chesi[240 + i];
                cells[cells.length - 4].innerHTML = chesi[120 + i];
                cells[cells.length - 3].innerHTML = chesi[280 + i];

                cells[cells.length - 2].innerHTML = t1;
                cells[cells.length - 1].innerHTML = t2;


                sum[0] += chesi[i];
                sum[1] += chesi[160 + i];
                sum[2] += chesi[40 + i];
                sum[3] += chesi[200 + i];
                sum[4] += chesi[80 + i];
                sum[5] += chesi[240 + i];
                sum[6] += chesi[120 + i];
                sum[7] += chesi[280 + i];
                sum[8] += t1;
                sum[9] += t2;

                sum2[0] += chesi[i + 20];
                sum2[1] += chesi[160 + i + 20];
                sum2[2] += chesi[40 + i + 20];
                sum2[3] += chesi[200 + i + 20];
                sum2[4] += chesi[80 + i + 20];
                sum2[5] += chesi[240 + i + 20];
                sum2[6] += chesi[120 + i + 20];
                sum2[7] += chesi[280 + i + 20];
                sum2[8] += chesi[i + 20] + chesi[40 + i + 20] + chesi[80 + i + 20] + chesi[120 + i + 20];
                sum2[9] += chesi[160 + i + 20] + chesi[200 + i + 20] + chesi[240 + i + 20] + chesi[280 + i + 20];

                sum3[0] += chesi[i + 20];
                sum3[1] += chesi[160 + i + 20];
                sum3[2] += chesi[40 + i + 20];
                sum3[3] += chesi[200 + i + 20];
                sum3[4] += chesi[80 + i + 20];
                sum3[5] += chesi[240 + i + 20];
                sum3[6] += chesi[120 + i + 20];
                sum3[7] += chesi[280 + i + 20];
                sum3[8] += chesi[i + 20] + chesi[40 + i + 20] + chesi[80 + i + 20] + chesi[120 + i + 20];
                sum3[9] += chesi[160 + i + 20] + chesi[200 + i + 20] + chesi[240 + i + 20] + chesi[280 + i + 20];

                if (i == 9 || i == 12) {
                    for (j = 0; j < 10; j++) {
                        mt.rows[20 + k].cells[j + (mt.rows[20 + k].cells.length == 11 ? 1 : 2)].innerHTML = sum3[j];
                    }
                    sum3 = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                    k++;
                }
            }

            for (i = 0; i < 10; i++) {
                mt.rows[19].cells[i + 1].innerHTML = sum[i];
                mt.rows[23].cells[i + 1].innerHTML = sum2[i];
            }
            mt.rows[20].cells[1].innerHTML = "8-10#";
            mt.rows[21].cells[0].innerHTML = "11-13#";
        }

        for (i = 0; i < 10; i++) {
            mt.rows[7].cells[i + 1].innerHTML = fixFloat(Number(mt.rows[6].cells[i + 2].innerHTML) * rate1, 1);
            mt.rows[27].cells[i + 1].innerHTML = fixFloat(Number(mt.rows[26].cells[i + 2].innerHTML) * rate2, 1);
            mt.rows[29].cells[i + 1].innerHTML = fixFloat(Number(mt.rows[19].cells[i + 1].innerHTML) * rate3, 1);
        }
    };
    calc();
    
</script>
</body>
</html>
